<?php

/*
 * Green class
 *
 *
 * PHP versions 5
 * CAKEPHP versions 2.x
 * 
 * Green CMS - Content Management System and Framework Powerfull by Cakephp
 * Copyright 2012, GREEN GLOBAL CO., LTD (toancauxanh.vn)
 * 
 * CakePHP(tm) :  Rapid Development Framework (http://www.cakephp.org)
 * Copyright 2005-2011, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @author        Technology Lab No.I <tech1@toancauxanh.vn>
 * @link          
 * @package       Green.Utility
 * @since         Green v 1.0
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */

class Green {

    /**
     * Get get role keys in curent logged user
     *
     * @return array
     */
    public static function getRoles() {
        $Model = ClassRegistry::getObject('User');
        if (!$Model) {
            $Model = ClassRegistry::init('User.User');
        }
        $anonymous = false;
        $user = AuthComponent::user();
        if (!$user) {
            $anonymous = true;
        }
        return $Model->getRoles($user, $anonymous);
    }

}
